<?php
session_start();
include("config.php");

function tomb($size, $precision = 2)
{
    $base = log($size) / log(1024);
    $suffixes = array('', 'KB', 'MB', 'GB', 'TB');   

    return round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)];
}

$webspace = tomb($config_var[1]);
$max_upload = tomb($config_var[2]);

include_once("header.php");

echo "<div class='ptitle'>$title: $desc</div>\n";

?>


<?php

		echo "<div id='ctrlnav'>\n";
		if(!isset($_SESSION['hostz-user']) && !isset($_SESSION['hostz-passwd'])) {

?>
	<a href="register.php">Register</a> &bull; <a href="login.php">Login</a>
<?php

		} else {

?>
	<a href="ctrl.php">My Drive</a> &bull; <a href="logout.php">Logout</a>
<?php

		}
		echo "</div>\n";

?>

<table style="margin:auto;">
	<tr>
		<td>
			<div id="packages">
				<?php echo $title; ?> was developed while influenced by ads, so we're extremely 
				grateful to bring a 100% ad-free, cost-free hosting platform. We plan to stay, to
				show people that free hosting can still exist without the invasive ads or fees.
				The shared location for each users static storage / web hosting is secured by SSL (https).
				The downside is, CGI is disabled for users. <?php echo $title; ?> is more-so here 
				for static hosting, but do remember if you have a small repository, or want to use
				for mirroring FOSS (free and open source software); please feel to do so! <br />
				<a href="https://ho.st.us.to/suckless">dl.suckless.org mirror</a> (example)<br /><br />
				If you're looking for FreeBox, we sincerely apologize for the shut-down of our free 
				VPS hosting services... Due to DMCA contact over piracy of copyrighted data, we've
				ceased usage to all users. If you were using FreeBox for web hosting, freehost is
				always an option.<br /><br />
				Remember, we charge absolutely no one, so if you like our services; please consider 
				donating to cover a cup of coffee and maybe that internet bill!
				<br /><br />
				<form action="https://www.paypal.com/donate" method="post" target="_top">
					<input type="hidden" name="cmd" value="_donations" />
					<input type="hidden" name="business" value="cdorm245@gmail.com" />
					<input type="hidden" name="currency_code" value="USD" />
					<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
					<img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
				</form>
				<br />
				Web Space: <?php echo $webspace; ?><br />
				Max Upload: <?php echo $max_upload; ?><br />
				User count: <?php
				
				$totalUsers = count( glob("users/*", GLOB_ONLYDIR) );
				echo $totalUsers;
				
				?><br /><br />
				Allowed upload extensions: 
				<?php 
				
				$array = $allowedExts;
				
				for ($i = 0; $i < count($array); $i++) {
					echo $array[$i];
					
					if($i < (count($array)-1)) {
						echo ", ";
					}
				}
				
				?>.<br />
			</div>
		</td>
	</tr>
</table>

<?php

include_once("footer.php");
?>
